package cn.itsource.ymjs.doc;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Document(indexName = "ymjs" , type = "course")
@Data
//课程 name，forUser gradeName tenantName ...
//课程类型  courseTypeId courseTypeName
//影响信息  price priceOld charge
public class CourseDoc {
    //PUT  /hrmtest/coursetest/1
    @Id //文档对象的ID就是该字段的值
    private Long id;
    //课程名称
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;
    //价格
    @Field(type = FieldType.Float)
    private Float amount;
    //课程类型
    @Field(type = FieldType.Long)
    private Long courseTypeId;
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String courseTypeName;
    // 作者
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String author;
    //等级名
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String gradeName;
    @Field(type = FieldType.Long)
    private Long gradeId;
    //图片
    @Field(type = FieldType.Keyword,index = false)
    private String logo;
    @Field(type = FieldType.Integer)
    private Integer number = 0;
//    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
//    private String all; //所有关键字要作用字段 假的，仅仅是用来搜索用的. 如果不这样做要做很多组合查询

//    public String getAll() {
//        return name+" "+forUser+" "+gradeName+" "+tenantName+" "+courseTypeName;
//    }
//
//    public void setAll(String all) {
//        this.all = all;
//    }

}